package com.ruoyi.project.system.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.SysEvaluates;
import com.ruoyi.project.system.service.ISysEvaluatesService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 评价图片Controller
 * 
 * @author jjp
 * @date 2020-04-29
 */
@RestController
@Api("评价图片")
@RequestMapping("/system/evaluates")
public class SysEvaluatesController extends BaseController
{
    @Autowired
    private ISysEvaluatesService sysEvaluatesService;

    /**
     * 查询评价图片列表
     */
    @PreAuthorize("@ss.hasPermi('system:evaluates:list')")
    @ApiOperation("查询评价图片列表")
    @GetMapping("/list")
    public TableDataInfo list(SysEvaluates sysEvaluates)
    {
        startPage();
        List<SysEvaluates> list = sysEvaluatesService.selectSysEvaluatesList(sysEvaluates);
        return getDataTable(list);
    }

    /**
     * 获取评价图片详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:evaluates:query')")
    @ApiOperation("获取评价图片详细信息")
    @GetMapping(value = "/{evaluateId}")
    public AjaxResult getInfo(@PathVariable("evaluateId") Long evaluateId)
    {
        return AjaxResult.success(sysEvaluatesService.selectSysEvaluatesById(evaluateId));
    }

    /**
     * 新增评价图片
     */
    @PreAuthorize("@ss.hasPermi('system:evaluates:add')")
    @ApiOperation("新增评价图片")
    @Log(title = "评价图片", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysEvaluates sysEvaluates)
    {
        return toAjax(sysEvaluatesService.insertSysEvaluates(sysEvaluates));
    }

    /**
     * 修改评价图片
     */
    @PreAuthorize("@ss.hasPermi('system:evaluates:edit')")
    @ApiOperation("修改评价图片")
    @Log(title = "评价图片", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysEvaluates sysEvaluates)
    {
        return toAjax(sysEvaluatesService.updateSysEvaluates(sysEvaluates));
    }

    /**
     * 删除评价图片
     */
    @PreAuthorize("@ss.hasPermi('system:evaluates:remove')")
    @ApiOperation("删除评价图片")
    @Log(title = "评价图片", businessType = BusinessType.DELETE)
	@DeleteMapping("/{evaluateIds}")
    public AjaxResult remove(@PathVariable Long[] evaluateIds)
    {
        return toAjax(sysEvaluatesService.deleteSysEvaluatesByIds(evaluateIds));
    }
}
